package com.julius.design.pattern.proxy;

/**
 * @author Administrator
 * @date 2021-06-28 下午 2:13
 * <p>
 *     代理测试类
 * </p>
 */
public class ProxyTest {


    public static void main(String[] args) {
//        StaticProxy staticProxy = new StaticProxy();
//        staticProxy.prettyPrint();
        // 保存生成的代理类的字节码文件
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles", "true");
        DynamicProxy proxy = new DynamicProxy(new TargetPrint());
        //这里只能用接口的引用去接收
        TargetInterface proxyInstance = proxy.getProxyInstance();


        proxyInstance.prettyPrint();
    }
}
